<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>权限管理</title>
<script type="text/javascript">
<!--
	var myEditUrl = '${pageContext.request.contextPath}/backend/system/authority/showPage?id=';
	var mydeleteUrl	= '${pageContext.request.contextPath}/backend/system/authority/toggle/';
//-->
</script>
</head>
<body>
  <!-- 标题 -->
	<div class="titleBar m_b_20">
		<div class="tit fl b_l_e74a5f">
			<h3 class="cn">权限管理</h3>
			<span class="en">authority information</span>
		</div>
		<div class="fr"></div>
	</div>
  <!-- end 标题 -->
  <form method="post" action="${pageContext.request.contextPath }/backend/system/authority/search" name="searchForm"  >
  <input type="hidden" name="pageNo" value="${dto.pageNo}">
  <input type="hidden" name="totalCount" value="${dto.totalCount}">
  <!-- 查询 -->
		<div class="box_03 p_20 m_b_20">
			  <table class="tb_style02" width="100%">
	                <tr>
	                	<th>名称</th>
	                	<td><input name="name" value="${dto.name}" style="width:200px;" class="input_style2" type="text" placeholder=""></td>
	                </tr>
	                			
	                <tr>
	                	<th>每页显示</th>
	                		<td colspan="5">
	                			<input style="width:50px;" class="input_style2" type="text" placeholder="" id="pageSize" name="pageSize" value="${dto.pageSize}"> 条
	                				<span style="margin-left:170px;">
	                					<input style="width:110px;" class="btn_brown02 m_r_12" type="button" name="searchData" id="searchData" value="查  询">
	                					<input style="width:110px;" class="btn_brown02 m_r_12" type="button" name="addResource" id="addResource" value="添 加">
	                				</span>
	                		</td>
	                </tr>
		       </table>
	    </div>
	<!-- end 查询 -->
</form>
<%
boolean incDisplayTable = true;
boolean incEditTable = false;
boolean incUploadDiv = false;
boolean incBatchDelete = false;
boolean incDisplayStatus =  true;
String uploadTmp="";
%>
<%@ include file="/WEB-INF/page/backend/common/inc_edit_page.jsp" %>	

<script>
$(function() {
	$("#addResource").click(function(){
		var id = 0;
		window.location.href= myEditUrl+id;
		}
	)
	$(".editData").click(function(){
		var id = $(this).attr("id");
		window.location.href= myEditUrl+id;
		}
	)
	
	$(".toggleAuthority").click(function(){
		var id = $(this).attr("id");
		var node = $(this);
		$.ajax({
			url:'${pageContext.request.contextPath}/backend/system/authority/toggle/' + id,
			type: 'POST',
			error: function(XMLHttpRequest, textStatus, errorThrown){
				alert('修改权限状态异常。' + textStatus + "/" + errorThrown);
				$("#loadStatus").css("display","none");
			},
			success: function(data){
				if(data.result == 1) {
					if(node.parent().parent().children("td:eq(3)").html().indexOf("启用") != -1) {
						alert("禁用权限成功");
						node.parent().parent().children("td:eq(3)").html("<font color=\"red\">禁用</font>");
					} else {
						alert("启用权限成功");
						node.parent().parent().children("td:eq(3)").html("<font color=\"green\">启用</font>");
					}
				} else {
					alert("修改权限异常，异常信息：" + data.errorMessage);
				}
			}
		});
	});
	

});
</script>
</body>
</html>